package com.ywk.openFeignServer2.config;

import feign.RequestInterceptor;
import feign.RequestTemplate;
import org.springframework.context.annotation.Configuration;
import org.springframework.http.HttpHeaders;

/**
 * 拦截器：只要通过FeignClient访问的接口都会走这个地方
 *
 * @Author zbh
 * @Date 2023/8/17
 */
@Configuration
public class FeignRequestInterceptor implements RequestInterceptor {

    /**
     * 拦截，添加Header信息：如token
     * @param requestTemplate
     */
    @Override
    public void apply(RequestTemplate requestTemplate) {
        requestTemplate.header(HttpHeaders.AUTHORIZATION,"ywk");
    }
}
